package com.chukun.flink.stream.action.fraud.rules.functions;

import com.chukun.flink.stream.action.fraud.rules.model.TimestampAssignable;
import org.apache.flink.api.common.functions.RichFlatMapFunction;
import org.apache.flink.util.Collector;

/**
 * @author chukun
 * @version 1.0.0
 * @description 设置时间戳
 * @createTime 2022年05月22日 15:38:00
 */
public class TimeStamper <T extends TimestampAssignable<Long>> extends RichFlatMapFunction<T, T> {

    @Override
    public void flatMap(T value, Collector<T> collector) throws Exception {
        value.assignIngestionTimestamp(System.currentTimeMillis());
        collector.collect(value);
    }
}
